import React, {useEffect, useState} from 'react';
import useTable from "@/cms/use/useTable";
import {memberStatusList} from "@/pages/constant";
import useFilter from "@/cms/use/useFilter";

function Orders(props) {
    const [roomList,setRoomList] = useState([])
    const {queryList,tableDOM} = useTable({
        columns:[
            {
                title:"微信id",
                dataIndex:"wxId",
            },{
                title:"名字",
                dataIndex:"name"
            }, {
                title:"性别",
                dataIndex:"gender"
            },{
                title:"手机号",
                dataIndex:"phone",
            },{
                title:"会员等级",
                dataIndex:"level",
            },
            {
              title:"状态",
              dataIndex: "status",
              render(text){
                  return memberStatusList.find(item=>item.value === text)?.label
              }
            },
            {
                title:"积分",
                dataIndex: "score"
            },
            {
                title: "可用余额",
                dataIndex: "balance"
            }

        ],
        xhr:{
            query:"/app/memberList"
        },
    })
    const {FilterDOM} = useFilter({
        queryList,
        list:[
            {
                label:"手机号",
                name:"phone",
            },
            {
                label:"状态",
                name:"status",
                type:"select",
                options:memberStatusList
            }
        ]
    })

    return (
        <div>
            {FilterDOM}
            {tableDOM}
        </div>
    );
}

export default Orders;